// --------------------------------
// projects/collatz/RunCollatz.java
// Copyright (C) 2010
// Glenn P. Downing
// --------------------------------

/*
To run the program:
    % javac -Xlint RunCollatz.java
    % java  -ea    RunCollatz < RunCollatz.in > RunCollatz.out

To document the program:
    % javadoc -d html -private *.java
*/

import java.io.PrintStream;
import java.util.Scanner;

// ------
// Reader
// ------

final class Reader {
    private Scanner _s;

    public Reader () {
        _s = new Scanner(System.in);}

    public boolean hasNextInt () {
        return _s.hasNextInt();}

    public int nextInt () {
        return _s.nextInt();}}

// ------
// Writer
// ------

final class Writer {
    private PrintStream _ps;

    public Writer () {
        _ps = System.out;}

    public void write(String s) {
        _ps.println(s);}}

// ----------
// RunCollatz
// ----------

final class RunCollatz {
    public static void main (String[] args) {
        final Reader r = new Reader();
        final Writer w = new Writer();
        final int[]  a = new int[2];
        while (Collatz.read(r, a)) {
            final int v = Collatz.eval(a);
            Collatz.print(w, a, v);}}}

